package com.yuanlp.studentsystem.dao;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;

import com.yuanlp.studentsystem.bean.StudentInfo;
import com.yuanlp.studentsystem.db.StudentDBOpenHelper;

/**
 * Created by 原立鹏 on 2017/6/25.
 */

public class StudentInfoDao {

    private final StudentDBOpenHelper mStudentDBOpenHelper;

    public StudentInfoDao(Context context){
        mStudentDBOpenHelper = new StudentDBOpenHelper(context);
    }

    public void addStudent(StudentInfo student){
        SQLiteDatabase db = mStudentDBOpenHelper.getWritableDatabase();
        String id=student.getId()+"";
        String name=student.getName();
        String phone=student.getPhone();
        db.execSQL("insert into studentinfo(studentid,name,phone) values(?,?,?)",new String[]{id,name,phone});

    }
}
